package src 
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	/**
	 * Game Controler...
	 * @author Vitaly Vrublevskyy
	 */
	public class Game implements IGame 
	{
		private var _container:Sprite;
		
		private var grid:Grid; // model (geme data)
		private var board:Board;// Just UI
		
		public function Game() 
		{
			_container = new Sprite();
			
			board = new Board(); 
			board.x = (Main.stage.width - board.width) / 2;
			board.y = (Main.stage.height - board.height) / 2;
			//board.addEventListener(MouseEvent.CLICK, onEntityClick, true); //with capturing
			
			_container.addChild(board);
		}
		
		/* INTERFACE IGame */
		
		public function start():void 
		{
			grid = new Grid();
			grid.iniialize();
			
			board.setUp(grid.source);
			
		}		
		public function pause():void 
		{
			
		}
		
		public function tearDown():void 
		{
			_container.removeChild(board);
			board = null;
			
			grid = null;
		}
		
		public function get container():Sprite 
		{
			return _container;
		}
		
	}

}